diff options
| author | Adam Soltys <[email protected]> | 2024-09-24 13:22:31 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-24 13:22:31 -0700 |
| commit | 8aeb0d6d818b823afec1ee7e5749971468842c9c (patch) | |
| tree | c9e131848e0903a7629372c3642c99cc8697512a /src/routes/(app)/send/bitcoin/[address]/+layout.server.ts | |
| parent | 52871e09d9218f3f2fb2ce4bd6e97f5c1fc15480 (diff) | |
| download | coinos-ui-8aeb0d6d818b823afec1ee7e5749971468842c9c.tar.gz coinos-ui-8aeb0d6d818b823afec1ee7e5749971468842c9c.zip | |
fix signing
Diffstat (limited to 'src/routes/(app)/send/bitcoin/[address]/+layout.server.ts')
| -rw-r--r-- | src/routes/(app)/send/bitcoin/[address]/+layout.server.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts b/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts new file mode 100644 index 00000000..6c22f5f1 --- /dev/null +++ b/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts @@ -0,0 +1,12 @@ +import { auth, get } from "$lib/utils"; +import { redirect } from "@sveltejs/kit"; + +export async function load({ cookies, params }) { + let aid = cookies.get("aid"); + let { address } = params; + let { balance } = await get(`/account/${aid}`, auth(cookies)); + let invoice = await get(`/invoice/${address}`); + let recipient = await get(`/user/${invoice.uid}`); + if (invoice.aid === invoice.uid) redirect(307, `/send/${recipient.username}`); + return { balance }; +} |
